/* 
    file:   ui_dev.h
 */
/* ------------------------------------------------------------------------- */
#include "ui_dev.h"
/* ------------------------------------------------------------------------- */
void ui_disp_fill_soft(void * pbuf,unsigned int sx,unsigned int sy,\
                                    unsigned int ex,unsigned int ey,\
                                    unsigned short color,unsigned int width)
{
    unsigned int cntx = 0;
    unsigned int cnty = 0;

    unsigned char * pof;

    for(cnty = sy;cnty<= ey;cnty++)
    {
        pof = &((unsigned char *)pbuf)[width*2*cnty];

        for(cntx = sx;cntx<=ex;cntx++)
        {
            pof[cntx*2] = color&0xff;
            pof[cntx*2+1] = (color>>8)&0xff;
        }
    }
}
void ui_disp_fill(void * pbuf,unsigned int sx,unsigned int sy,\
                                unsigned int ex,unsigned int ey,\
                                unsigned short color)
{
    ui_disp_fill_soft(pbuf,sx,sy,ex,ey,color,800);
}
void ui_disp_copy_soft(void * pbuf,unsigned int sx,unsigned int sy,\
                                unsigned int ex,unsigned int ey,\
                                void * color,unsigned int width)
{
    unsigned int cntx = 0;
    unsigned int cnty = 0;

    unsigned char * pof;
    unsigned char * pif;
    for(cnty = sy;cnty<= ey;cnty++)
    {
        pof = &((unsigned char *)pbuf)[width*2*cnty];
        pif = &((unsigned char *)color)[width*2*cnty];
        for(cntx = sx;cntx<=ex;cntx++)
        {
            pof[cntx*2] = pif[cntx*2];
            pof[cntx*2+1] = pif[cntx*2+1];
        }
    }
}
void ui_disp_copy(void * pbuf,unsigned int sx,unsigned int sy,\
                            unsigned int ex,unsigned int ey,\
                            void * color,unsigned int width)
{
    ui_disp_copy_soft(pbuf,sx,sy,ex,ey,color,width);
}



/* ------------------------------------------------------------------------- */


